package leetcode_301_400;

public class LeeCode_372 {
    public static void main(String[] args) {

    }
    private static int superPow(int a, int[] b) {
        int ans = 1;
        for(int i = b.length - 1; i >= 0 ; --i){
            ans = (int) ((long) ans * pow(a, b[i]) % 1337);
            a = pow(a, 10);
        }
        return ans;
    }
    private static int pow(int x, int n){
        int res = 1;
        while (n != 0){
            if (n % 2 != 0){
                res  = (int)((long)res * x % 1337);
            }
            x = (int)((long)x * x % 1337);
            n /= 2;
        }
        return res;
    }
}
